Skip to content

Conversation

@jorgerangel-msft
Copy link
Contributor

@jorgerangel-msft jorgerangel-msft commented Oct 24, 2025

This PR adds a new regen preview developer script to aid in testing and validating changes made to the generator. It allows regenerating azure libraries locally using the local artifacts of the generator, helping to see what the regenerated code will look like with the applied changes.

contributes to: Azure/azure-sdk-for-net#52234

example run:
image

@github-actions
Copy link
Contributor

No changes needing a change description found.

@azure-sdk
Copy link
Collaborator

azure-sdk commented Oct 24, 2025

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@jorgerangel-msft jorgerangel-msft force-pushed the local-regen-preview branch 2 times, most recently from 045f8f5 to e281f31 Compare October 24, 2025 21:57
@jorgerangel-msft jorgerangel-msft changed the title [wip] add regen preview local script add regen preview local validation script Oct 24, 2025
@jorgerangel-msft jorgerangel-msft marked this pull request as ready for review October 24, 2025 22:12
@jorgerangel-msft jorgerangel-msft changed the title add regen preview local validation script [http-client-csharp] add regen preview local validation script Oct 24, 2025
- Clean and build the unbranded and Azure generators with local changes
- Display an interactive menu to select which libraries to regenerate
- Regenerate only the selected libraries
- Restore all modified files on success
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this true? I think we leave the generated library changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should only be restoring the metadata files (package.json edits) on success. I'll update this text


Write-Host "=============================================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Enter library numbers to regenerate (comma-separated), 'all' for all libraries, or 'q' to quit:" -ForegroundColor White
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think we should be able to just leave it blank for all.

Prompts for library selection before regenerating.

.EXAMPLE
.\RegenPreview-Local.ps1 -AzureSdkForNetRepoPath "C:\repos\azure-sdk-for-net" -All
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: probably can just name it RegenPreview unless we were thinking of having a separate script that we would use for pipeline runs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was planning on having a separate process/script for pipeline runs, but I'll go ahead and rename it in case I can just reuse this script there.

2. Builds and packages the three NuGet generator framework packages with the same versioning
3. Updates Packages.Data.props in azure-sdk-for-net with the local NuGet version
4. Updates the Azure generator (@azure-typespec/http-client-csharp) to use the local unbranded generator
5. Builds and packages the Azure generator locally
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add in the steps to update the Mgmt generator and regen the mgmt libraries?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also would be great to include OpenAI if possible.

-DependencyType "dependencies"

# Clean and install
Push-Location $azureGeneratorPath
Copy link
Contributor

@JoshLove-msft JoshLove-msft Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we use the Invoke function from Generation.psm1?

@JoshLove-msft
Copy link
Contributor

I tested this locally making a change in CodeWriter to the auto-generated string and ran for all libraries, but only Azure.AI.Projects showed any diffs.

@jorgerangel-msft
Copy link
Contributor Author

I tested this locally making a change in CodeWriter to the auto-generated string and ran for all libraries, but only Azure.AI.Projects showed any diffs.

Strange. I tested this on 2 separate machines and it worked fine. I'll need to debug to see why that would happen.

@JoshLove-msft
Copy link
Contributor

I tested this locally making a change in CodeWriter to the auto-generated string and ran for all libraries, but only Azure.AI.Projects showed any diffs.

Strange. I tested this on 2 separate machines and it worked fine. I'll need to debug to see why that would happen.

Hmm let me try again.

@JoshLove-msft
Copy link
Contributor

I tested this locally making a change in CodeWriter to the auto-generated string and ran for all libraries, but only Azure.AI.Projects showed any diffs.

Strange. I tested this on 2 separate machines and it worked fine. I'll need to debug to see why that would happen.

Hmm let me try again.

Nevermind - I must have been looking at an out of sync diff. It is working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants